import 'dart:ffi';

import 'package:elevator/get/message.dart';
import 'package:elevator/model/build_detail.dart';
import 'package:get/get.dart';

import '../../model/user.dart';
import 'build_detail_state.dart';

class BuildDetailLogic extends GetxController {
  final BuildDetailState state = BuildDetailState();


  @override
  void onInit() {
    state.buildInfo = Get.arguments["buildInfo"];
    state.user = Get.arguments["user"];
    state.buildDetail.value = state.buildInfo.buildDetail;
    super.onInit();
  }


  void goToSettingPage() { Get.toNamed("/setting",arguments: {"user":state.user});}

  String getBuildName() {
    return Messages.isCzLocal? state.buildDetail.value.buildNameCn:state.buildDetail.value.buildNameEn;
  }

  String getBuildAddr() {
    return Messages.isCzLocal? state.buildDetail.value.buildAddrCn:state.buildDetail.value.buildAddrEn;
  }

  String getSubZone() {
    return Messages.isCzLocal? state.buildDetail.value.buildSubZoneCn:state.buildDetail.value.buildSubZoneEn;

  }

  String getSubName() {
    return Messages.isCzLocal? state.buildDetail.value.buildTypeCn:state.buildDetail.value.buildTypeZn;
  }

  String getBuildContact() {
    return Messages.isCzLocal? state.buildDetail.value.buildContractCn:state.buildDetail.value.buildContractEn;
  }
}

